public class Digui {
    public static int factor(int i) {
        if (i == 1) {
            return 1;
        }else {
            return i * factor(i-1);
        }

    }
    public static void main(String[] args) {
        int n = 4;
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum = sum + factor(i);
        }
        System.out.println(sum);
    }
}
